package com.dongdongshop.service.impl;

import com.dongdongshop.mapper.TbOrderItemMapper;
import com.dongdongshop.pojo.TbOrderItem;
import com.dongdongshop.pojo.TbOrderItemExample;
import com.dongdongshop.service.OrderItemService;
import org.apache.dubbo.config.annotation.DubboService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service
@DubboService
public class OrderItemServiceItem implements OrderItemService {
    @Resource
    private TbOrderItemMapper tbOrderItemMapper;

    @Override
    public List<TbOrderItem> selectByOrderId(Long orderId) {
        TbOrderItemExample example = new TbOrderItemExample();
        TbOrderItemExample.Criteria criteria = example.createCriteria();
        criteria.andOrderIdEqualTo(orderId);
        criteria.andStatusEqualTo("2");
        List<TbOrderItem> orderItemList = tbOrderItemMapper.selectByExample(example);
        return orderItemList;
    }

    @Override
    public void updateOrderItemByOrderId(String timeId, Long orderId) {
        tbOrderItemMapper.updateOrderItemByOrderId(timeId,orderId);
    }

    @Override
    public List<TbOrderItem> selectByTimeIdAndOrderId(String out_request_no, Long orderId) {
        List<TbOrderItem> orderItemList = tbOrderItemMapper.selectByTimeIdAndOrderId(orderId);
        return orderItemList;
    }

    @Override
    public void updateOrderItemByTradeOn(String out_biz_on, String out_trade_no) {
        tbOrderItemMapper.updateOrderItemByTradeOn(out_biz_on,out_trade_no);
    }

}
